#ifndef QTVISIONTEST_ELBUTTON_H
#define QTVISIONTEST_ELBUTTON_H
#include <QPushButton>
#include <QString>
#include <QIcon>

class ElButton : public QPushButton
{
Q_OBJECT
public:
    enum BtnType {
        Default,
        Primary,
        Success,
        Danger,
        Warning
    };
    Q_ENUM(BtnType)

    enum BtnShape {
        Rect,       // 常规矩形
        Round,      // 圆角按钮
        Circle      // 圆形图标按钮
    };
    Q_ENUM(BtnShape)

    explicit ElButton(const QString &text = "",
                      BtnType type = Default,
                      BtnShape shape = Rect,
                      QWidget *parent = nullptr);

    void setBtnType(BtnType type);
    BtnType btnType() const;

    void setBtnShape(BtnShape shape);
    BtnShape btnShape() const;

    void setBtnIcon(const QIcon &icon, int size = 24);

private:
    BtnType m_type;
    BtnShape m_shape;
    QIcon m_icon;
    int m_iconSize;

    void updateStyle();
};
#endif //QTVISIONTEST_ELBUTTON_H
